package com.yudaob2b.business.service;

/**
 * @author Kidd.Tan
 * @Date 2018/2/8
 * @Time 11:35
 */
public interface RedisLockService {

    /**
     * 获取锁
     *
     * @param lockKey
     * @param timeoutMsecs
     * @return 获取锁成功返回ture，超时返回false
     * @throws InterruptedException
     */
    boolean lock(String lockKey, int timeoutMsecs) throws InterruptedException;

    /**
     * 获取锁
     * @return 获取锁成功返回ture，超时返回false
     * @throws InterruptedException
     */
    boolean lock(String lockKey) throws InterruptedException;

    /**
     * 释放获取到的锁
     */
    void unlock(String lockKey);
}
